package com.mijie.homi.dao.album;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.HashMap;

import org.springframework.stereotype.Repository;

import com.mijie.core.IBatisDao;
import com.mijie.homi.domain.album.Album;

@Repository
public class AlbumDao extends IBatisDao {

	public int createAlbum(Album album){
		this.insert("createAlbum", album);
		return album.getId()==null?0:album.getId();
	}
	
	public int deleteAlbum(int id,int userId){
		HashMap<String,Object> parameter = new HashMap<String,Object>();
		parameter.put("userId",userId);
		parameter.put("id",id);
		return this.delete("deleteAlbum", parameter);
	}
	
	public Album getAlbum(int id){
		return this.selectOne("getAlbum", id);
	}
	
	public List<Album> listAlbum(int userId,long idx,int limit){
		HashMap<String,Object> parameter = new HashMap<String,Object>();
		parameter.put("userId",userId);
		parameter.put("idx",idx);
		parameter.put("limit",limit);
		return this.selectList("listAlbum",parameter);
	}
	
}
